﻿using UnityEngine;

namespace TC
{
    [Menu("Variable/Random")]
    public class Random : VariableNode
    {
        public ValueOutput<Quaternion> rotation;
        public ValueOutput<Vector3> onUnitSphere;
        public ValueOutput<Vector2> insideUnitCircle;
        public ValueOutput<Vector3> insideUnitSphere;
        public ValueOutput<float> value;
        public ValueOutput<Quaternion> rotationUniform;

        public ValueInput<int> minInt;
        public ValueInput<int> maxInt;
        public ValueOutput<int> rangeInt;

        public ValueInput<float> minfloat;
        public ValueInput<float> maxfloat;
        public ValueOutput<float> rangeFloat;

        public override void OnCreate()
        {
            base.OnCreate();

            rotation = this.AddValueOutPort("rotation", ()=> { return UnityEngine.Random.rotation; });
            onUnitSphere = this.AddValueOutPort("onUnitSphere", () => { return UnityEngine.Random.onUnitSphere; });
            insideUnitCircle = this.AddValueOutPort("insideUnitCircle", () => { return UnityEngine.Random.insideUnitCircle; });
            insideUnitSphere = this.AddValueOutPort("insideUnitSphere", () => { return UnityEngine.Random.insideUnitSphere; });
            value = this.AddValueOutPort("value", () => { return UnityEngine.Random.value; });
            rotationUniform = this.AddValueOutPort("rotationUniform", () => { return UnityEngine.Random.rotationUniform; });

            minInt = this.AddValueInPort<int>("min int");
            maxInt = this.AddValueInPort<int>("max int");
            rangeInt = this.AddValueOutPort("rangeInt", () => { return UnityEngine.Random.Range(minInt.Value, maxInt.Value); });

            minfloat = this.AddValueInPort<float>("min");
            maxfloat = this.AddValueInPort<float>("max");
            rangeFloat = this.AddValueOutPort("range float", () => { return UnityEngine.Random.Range(minfloat.Value, maxfloat.Value); });
        }


    }
}
